-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup #713
Conversation
Internal simple task objects feels like a more maintainable pattern than traits do.
There is no suitable class in CakePHP. The database layer uses `QueryExpression` to add raw SQL to specific query clauses, and thus has no way to represent a literal value without providing a broad type.
It was not implemented before via migrations and doesn't need to exist anymore.
We only ever operate on a single path in the new flow. The console arguments drive the migration configuration much more in the built-in implementation. The parameters have good defaults and can be customized, but there is no way to have more than one path presently.
|
||
if (is_string($this->values['paths']['seeds'])) { | ||
$this->values['paths']['seeds'] = [$this->values['paths']['seeds']]; | ||
if (is_array($this->values['paths']['seeds']) && isset($this->values['paths']['seeds'][0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this being an array if it's hard-coded to index 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to keep compatibility with all the tests that provide a list of paths.
@@ -71,7 +82,7 @@ protected function getTablesToBake(CollectionInterface $collection, array $optio | |||
|
|||
$config = (array)ConnectionManager::getConfig($this->connection); | |||
$key = isset($config['schema']) ? 'schema' : 'database'; | |||
if ($config[$key] === $split[1]) { | |||
if (isset($split[0]) && $config[$key] === $split[1]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this check $split[1] not 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were mostly to appease phpstan/psalm that were complaining about unchecked index access within the if block. I can add more isset() checks for 1 as well.
@@ -186,7 +197,7 @@ protected function fetchTableName(string $className, ?string $pluginName = null) | |||
$config = ConnectionManager::getConfig($this->connection); | |||
if ($config) { | |||
$key = isset($config['schema']) ? 'schema' : 'database'; | |||
if ($config[$key] === $splitted[1]) { | |||
if (isset($splitted[0]) && $config[$key] === $splitted[1]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Clean up several TODOs I had left behind while porting code in from phinx. I tried to leave useful commit logs for each of the changes.
Part of #647